/**
 * UserStat.java
 * 
 * Contains the fields needed to record a user's record for any statistic at a point.
 * (Ex: Weight, cholesterol, etc.)
 * 
 * @author Chris
 */

package b1w1nn1ng.crossf1t.business;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class UserStat {
	private String type; //The name of the statistic (Weight)
	private Date date; //The date this stat was recorded
	private double value; //The value of this statistic.
	
	public UserStat(String type, Date date, double value) {
		this.type = type;
		this.date = date;
		this.value = value;
	}
	
	public UserStat(String type, String date, double value) throws ParseException {
		this.type = type;
		SimpleDateFormat dfm = new SimpleDateFormat("MM/dd/yyyy");
		this.date = dfm.parse(date);
		this.value = value;
	}
	
	public UserStat() {
		type = "none";
		date = new Date();
		value = 0;
	}
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Date getDate() {
		return date;
	}
	
	public String getFormattedDate() {
		SimpleDateFormat dfm = new SimpleDateFormat("MM/dd/yyyy");
		return dfm.format(date);
	}
	
	public void setDate(Date date) {
		this.date = date;
	}
	
	public void setFormattedDate(String setDate) throws ParseException {
		SimpleDateFormat dfm = new SimpleDateFormat("MM/dd/yyyy");
		date = dfm.parse(setDate);
	}
	
	public double getValue() {
		return value;
	}
	
	public void setValue(double value) {
		this.value = value;
	}
	
	
}
